<template>
  <el-form :model="form" :rules="rules" ref="form">
    <el-form-item label="项目名称" prop="projectName" :label-width="formLabelWidth">
      <el-input v-model="form.projectName" autocomplete="off" maxlength="50"></el-input>
    </el-form-item>
    <el-form-item label="描述" prop="projectDesc" :label-width="formLabelWidth">
      <el-input type="textarea" v-model="form.projectDesc" maxlength="250"></el-input>
    </el-form-item>
  </el-form>
</template>

<script>
import { Vue, Component } from 'vue-property-decorator'
import { mapState } from 'vuex'

@Component({
  computed: {
    ...mapState('EditProjectModal', {
      form: state => state.form,
    })
  },
})

export default class ProjectForm extends Vue {
  formLabelWidth = '120px'

  get rules() {
    return {
      projectName: [
        { required: true, message: '请输入', trigger: 'blur' }
      ]
    }
  }

  checkForm() {
    return this.$refs.form.validate()
  }
}
</script>